<?php
	
	drupal_set_title('');
	$url = $config->getVar('url');
	drupal_add_css('bdbdec/view/css/viewElement.css');
	drupal_add_css('bdbdec/view/css/jqueryRating.css');
	drupal_add_js('bdbdec/view/scripts/displayList.js');
	drupal_add_js('bdbdec/view/scripts/jqueryRating.js');
	drupal_add_js('misc/collapse.js');
		
	echo '
	<div id="tabs-wrapper" class="clear-block">
		<h2 class="with-tabs">'.$publisher->getName().'</h2>
	</div>
	<table>
		<thead>
			<tr>
				<th colspan="2">
					<a href="'.$url.'/bdbdec.php?action=displayList&amp;element=publisher">Retour &agrave; la liste des &eacute;diteurs</a>
				</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td class="informations">
					<table>
						<thead>
							<tr>
								<th colspan="4" class="center">Informations sur l\'&eacute;diteur</th>
							</tr>
						</thead>
						<tbody>
							<tr>
								<td class="title bold">Nom de l\'&eacute;diteur :</td><td class="value">'.$publisher->getName().'</td>
								<td class="title bold">Nombre d\'albums :</td><td class="value">'.$publisher->nb_al.'</td>
							</tr>
							<tr>
								<td colspan="4">
									<table>
										<thead>
											<tr>
												<th class="center" colspan="4">
													Liste des albums auxquels l\'auteur a particip&eacute;
												</th>
											</tr>
										</thead >
										<tbody>';
										
									$count = count($publisher->getAlbumsList());
									$i=0;
									$albumsList = $publisher->getAlbumsList();
									echo '
											<tr>
												<td>
													Titre de l\'album
												</td>
												<td>
													Note de l\'album
												</td>
												<td>
													Nom de la s&eacute;rie
												</td>
												<td>
													Tome
												</td>
											</tr>';
											
									foreach ($albumsList as $book)
									{
										echo '
											<tr>
												<td><a href="'.$url.'/bdbdec.php?action=viewElement&amp;element=book&amp;id='.$book->getId().'">'.$book->al_name.'</a></td>
												<td>';
												$note = round($book->no_mean);
												for ($r = 1; $r < 11; $r++)
												{
													$checked = '';
													if ($r == $note)
														$checked = 'checked="checked"';
													echo '<input name="rating_disabled_all_albums'.$book->getId().'" type="radio" value="'.$r.'" class="star" disabled="disabled" '.$checked.'/>';
												}
												echo '
												</td>
												<td><a href="'.$url.'/bdbdec.php?action=viewElement&amp;element=serie&amp;id='.$book->se_id.'">'.$book->se_name.'</a></td>
												<td>'.$book->al_tome.'</td>
											</tr>';
									}    
								
								echo ' 
										</tbody>   
									</table>
								</td>
							</tr>
						</tbody>
					</table>
					
				</td>
			</tr>
			<tr>
				<td colspan="2" class="right">';
			if ($user->isAllowedTo(GRADE_MOD_BOOK))
				echo '<small><a href=""> Modifier cet &eacute;diteur</a></small>';
				echo '
				</td>
			</tr>
		</tbody>
		<tfoot>
			<tr>
			
			</tr>
		</tfoot>
	</table>';
	
?>